function TablePurchases(container, item, options) {

  this._container = container;
  this._item = item;
  this._options = options;
  this._createElements();
};
TablePurchases.prototype._createElements = function() {
  var gui, table, _self = this, unique = MiscUtils.unique();
  if (this._options.packageOnly){
    table = document.createElement('table');
    table.style.width = '900px';
    table.style.height = '24px';
    table.cellPadding = 0;
    table.cellSpacing = 0;
    table.id = unique + '_purchases_table';
    this._container.appendChild(table);
    
    tr = table.insertRow(-1);
    td = tr.insertCell(-1);
    td.style.backgroundColor = '#7a5052';
    td.style.borderRight = 'solid 1px #fff';
    td.style.width = '340px';
    td.style.height = '24px';
    td.style.fontFamily = '';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '9pt';
    td.style.color = 'white';
    td.style.padding = '0 0 0 20px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'middle';
    td.appendChild(document.createTextNode('Product'));
    
    td = tr.insertCell(-1);
    td.style.backgroundColor = '#7a5052';
    td.style.borderRight = 'solid 1px #fff';
    td.style.width = '50px';
    td.style.height = '24px';
    td.style.fontFamily = '';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '9pt';
    td.style.color = 'white';
    td.style.padding = '0 0 0 20px';
    td.style.letterSpacing = '1px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'middle';
    td.appendChild(document.createTextNode('Qty'));
    
    td = tr.insertCell(-1);
    td.style.backgroundColor = '#7a5052';
    td.style.borderRight = 'solid 1px #fff';
    td.style.width = '100px';
    td.style.height = '24px';
    td.style.fontFamily = '';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '9pt';
    td.style.color = 'white';
    td.style.padding = '0 0 0 20px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'middle';
    td.appendChild(document.createTextNode('Unit'));
    
    td = tr.insertCell(-1);
    td.style.backgroundColor = '#7a5052';
    td.style.borderRight = 'solid 1px #fff';
    td.style.width = '210px';
    td.style.height = '24px';
    td.style.fontFamily = '';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '9pt';
    td.style.color = 'white';
    td.style.padding = '0 0 0 20px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'middle';
    td.appendChild(document.createTextNode('Price'));
    
    td = tr.insertCell(-1);
    td.style.backgroundColor = '#7a5052';
    td.style.width = '80px';
    td.style.height = '24px';
    td.style.textAlign = 'center';
    td.style.verticalAlign = 'middle';
  } else {
    table = document.createElement('table');
    table.style.width = '860px';
    table.style.height = '24px';
    table.cellPadding = 0;
    table.cellSpacing = 0;
    table.id = unique + '_purchases_table';
    this._container.appendChild(table);
    
    tr = table.insertRow(-1);
    td = tr.insertCell(-1);
    td.style.borderRight = 'solid 1px #fff';
    td.style.width = '320px';
    td.style.height = '24px';
    td.style.fontFamily = '';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '9pt';
    td.style.color = 'white';
    td.style.padding = '0 0 0 20px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'middle';
    td.style.backgroundColor = '#7a5052';
    td.appendChild(document.createTextNode('Product'));
    
    td = tr.insertCell(-1);
    td.style.borderRight = 'solid 1px #fff';
    td.style.width = '50px';
    td.style.height = '24px';
    td.style.fontFamily = '';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '9pt';
    td.style.color = 'white';
    td.style.padding = '0 0 0 20px';
    td.style.letterSpacing = '1px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'middle';
    td.style.backgroundColor = '#7a5052';
    td.appendChild(document.createTextNode('Qty'));
    
    td = tr.insertCell(-1);
    td.style.borderRight = 'solid 1px #fff';
    td.style.width = '100px';
    td.style.height = '24px';
    td.style.backgroundColor = '#7a5052';
    td.style.fontFamily = '';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '9pt';
    td.style.color = 'white';
    td.style.padding = '0 0 0 20px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'middle';
    td.appendChild(document.createTextNode('Unit'));
    
    td = tr.insertCell(-1);
    td.style.borderRight = 'solid 1px #fff';
    td.style.width = '190px';
    td.style.height = '24px';
    td.style.fontFamily = '';
    td.style.fontWeight = 'bold';
    td.style.backgroundColor = '#7a5052';
    td.style.fontSize = '9pt';
    td.style.color = 'white';
    td.style.padding = '0 0 0 20px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'middle';
    td.appendChild(document.createTextNode('Price'));
    
    td = tr.insertCell(-1);
    td.style.backgroundColor = '#7a5052';
    td.style.width = '80px';
    td.style.height = '24px';
    td.style.textAlign = 'center';
    td.style.verticalAlign = 'middle';
  }
  gui = GuiTablePurchases.instance(unique);
  new HandleTablePurchases(gui, this._item, this._options);
};